﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Acme.BookStore2.Migrations
{
    public partial class vehiclemaintenance : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_VehicleMaintenanceRecords",
                table: "VehicleMaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "FollowUpDate",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "RepairItemName",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "RepairedDate",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "Repairer",
                table: "AppVehicleRepairRecord");

            migrationBuilder.RenameTable(
                name: "VehicleMaintenanceRecords",
                newName: "AppVehicleMaintenanceRecord");

            migrationBuilder.AlterColumn<string>(
                name: "Cost",
                table: "AppVehicleRepairRecord",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(18,2)");

            migrationBuilder.AddColumn<string>(
                name: "Detail",
                table: "AppVehicleRepairRecord",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndDate",
                table: "AppVehicleRepairRecord",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "StartDate",
                table: "AppVehicleRepairRecord",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Technician",
                table: "AppVehicleRepairRecord",
                maxLength: 128,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Cost",
                table: "AppVehicleMaintenanceRecord",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Detail",
                table: "AppVehicleMaintenanceRecord",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "EndDate",
                table: "AppVehicleMaintenanceRecord",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Location",
                table: "AppVehicleMaintenanceRecord",
                maxLength: 128,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Remark",
                table: "AppVehicleMaintenanceRecord",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "StartDate",
                table: "AppVehicleMaintenanceRecord",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Technician",
                table: "AppVehicleMaintenanceRecord",
                maxLength: 128,
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "VehicleId",
                table: "AppVehicleMaintenanceRecord",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppVehicleMaintenanceRecord",
                table: "AppVehicleMaintenanceRecord",
                column: "Id");

            migrationBuilder.CreateIndex(
                name: "IX_AppVehicleMaintenanceRecord_VehicleId",
                table: "AppVehicleMaintenanceRecord",
                column: "VehicleId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_AppVehicleMaintenanceRecord",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropIndex(
                name: "IX_AppVehicleMaintenanceRecord_VehicleId",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "Detail",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "EndDate",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "StartDate",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "Technician",
                table: "AppVehicleRepairRecord");

            migrationBuilder.DropColumn(
                name: "Cost",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "Detail",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "EndDate",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "Location",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "Remark",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "StartDate",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "Technician",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.DropColumn(
                name: "VehicleId",
                table: "AppVehicleMaintenanceRecord");

            migrationBuilder.RenameTable(
                name: "AppVehicleMaintenanceRecord",
                newName: "VehicleMaintenanceRecords");

            migrationBuilder.AlterColumn<decimal>(
                name: "Cost",
                table: "AppVehicleRepairRecord",
                type: "decimal(18,2)",
                nullable: false,
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "FollowUpDate",
                table: "AppVehicleRepairRecord",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "RepairItemName",
                table: "AppVehicleRepairRecord",
                type: "varchar(128) CHARACTER SET utf8mb4",
                maxLength: 128,
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "RepairedDate",
                table: "AppVehicleRepairRecord",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Repairer",
                table: "AppVehicleRepairRecord",
                type: "varchar(128) CHARACTER SET utf8mb4",
                maxLength: 128,
                nullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_VehicleMaintenanceRecords",
                table: "VehicleMaintenanceRecords",
                column: "Id");
        }
    }
}
